﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PessMvc.Models
{
    public class ActivityProgressModel
    {
        public int ActivityID { get; set; }
        public List<SubjectProgressModel> SubjectProgressList { get; set; }
        public int ArchiveTotal 
        {
            get
            {
                int? total=0;
                if (SubjectProgressList != null)
                {                
                    total = (from s in SubjectProgressList
                                 select s.ArchiveTotal).Sum();                 
                }
                return total==null?0:(int)total;
            }
        }
        public int ArchiveGradedTotal
        {
            get
            {
                int? total=0;
                if (SubjectProgressList != null)
                {                
                    total = (from s in SubjectProgressList
                                 select s.ArchiveGradedCount).Sum();                 
                }
                return total==null?0:(int)total;
            }
        }
    }

    public class SubjectProgressModel
    {
        public string SubjectName { get; set; }
        public int? ArchiveTotal { get; set; }
        public int? ArchiveGradedCount { get; set; }
    }
}